package cn.iocoder.yudao.module.cms.article.controller.app;

import cn.iocoder.yudao.framework.business.category.pojo.vo.CategorySimpleVO;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.cms.article.service.ArticleCategoryService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import jakarta.annotation.security.PermitAll;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;

@Tag(name = "用户 App - 文章分类")
// 注意避免与 promotion 模块的 AppArticleCategoryController 出现同名 Bean 冲突
@RestController("cmsAppArticleCategoryController")
@RequestMapping("/cms/article-category")
@Validated
public class AppArticleCategoryController {

    @Resource
    private ArticleCategoryService articleCategoryService;

    @GetMapping("/simple-list")
    @Operation(summary = "获得分类列表")
    @PermitAll
    public CommonResult<List<CategorySimpleVO>> getCategorySimpleList() {
        List<CategorySimpleVO> list = articleCategoryService.getSimpleList();
        return success(list);
    }

}
